1. Field of the Invention
The present invention relates to a focus detection apparatus and method used for automatic focus detection.
2. Description of the Related Art
Conventionally, a variety of cameras or the like having a so-called automatic focusing (AF) function have been suggested. The AF function is to automatically focus on a subject by detecting a focus state of the subject and then changing a position of an imaging lens in response to the detected focus state. In a method of detecting a focus state, a camera or the like having the AF function makes a subject image be formed on an image sensor comprising a plurality of pixels which include photoelectric converters. Then, a plurality of pixel signals output from the image sensor are subjected to a predetermined calculation, thereby the focus state is detected (See Japanese Patent Laid-Open No. 11-150686).
In this method, in order to detect focus states of subjects having different luminance levels, from a subject with high luminance to a subject with low luminance, at high precision, it is necessary to properly control a gain used for reading out a signal and a charge accumulation period in an image sensor. This is because, if the level of an image signal of the subject formed from a plurality of pixel signals is too large, the levels of some pixel signals that can be processed in the apparatus may exceed a saturation level, the resultant image signal may be apart from an image signal that properly represents the subject, which results in deterioration of precision. On the contrary, if the level of the image signal is too small, a noise in the image signal relatively increases, which may cause deterioration of precision.
On the other hand, a phase difference detection method is well-known in general as an automatic focus detection method for cameras. With the phase difference detection method, a light flux that comes from a subject and has passed through different exit pupil areas of an imaging lens are caused to form an image on a pair of line sensors of photoelectric conversion devices (AF sensors) for focus detection. The focus state of the imaging lens is detected by calculating relative positions of a pair of subject images obtained by performing photoelectric conversion with the pair of line sensors (hereinafter referred to as “phase difference calculation”). Recently, various kinds of AF sensors have been proposed in which a plurality of line sensor pairs are arranged such that focus states of a plurality of areas in a screen can be detected.
For example, Japanese Patent No. 3854704 discloses the following control. That is to say, photoelectric conversion elements are arranged at positions corresponding to a plurality of focus detection areas, accumulation time is controlled for respective areas 1 to n by sequentially circulating through and monitoring the area 1 to the area n, and the gain at the time of reading out a pixel signal is appropriately controlled for each area. The pixel signal can be read out with an appropriate gain even when the subject has different luminance levels, by appropriately controlling charge accumulation for each area.
In the conventional technique as disclosed in Japanese Patent Laid-Open No. 11-150686, accumulation is controlled so that responsiveness and focus detection precision are both satisfied using a PB signal which indicates a difference between the maximum value and minimum value of an image signal of the subject. However, if the PB signal of the subject is sufficient but the sharpness of the subject is small, focus detection precision deteriorates.
Further, with the focus detection apparatus using the photoelectric conversion device disclosed in Japanese Patent No. 3854704, the circulation cycle is lengthened, possibly resulting in a delay of accumulation end timing. For example, in the case where the luminance of a subject has changed and become brighter while signals of other areas are monitored, in some cases accumulation is not stopped properly, and charge may be accumulated to a level that exceeds a dynamic range of an output circuit of an AF sensor and a dynamic range of an AD converter (saturation). Further, in the case where a subject has a super-high luminance, accumulation end control is not made in time, and in some cases a pixel signal of the super-high luminance area may saturate. If the focus detection calculation is performed using the saturated signals, focus detection precision may deteriorate.